{extend name="web/public/base" /}
{block name="header"}
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">市场管理</li>
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <div style="margin-top:5px;margin-bottom: 8px;">
                <a type="button" class="btn btn-primary" href="{:url('editCate')}">新 增</a>
            </div>
            <section class="panel panel-default">
                <header class="panel-heading"> {$title}</header>
                {notempty name="_list"}
                <div class="table-responsive">
                    <table class="table table-striped table-hover b-t b-light text-sm">
                        <thead>
                        <tr>
                            <th width="80px" onclick="sort('user_num',this)" class="th-sortable active"
                                data-toggle="class">编号 <span class="th-sort"> </span>
                            </th>
                            <th>分类名称</th>
                            <th>父级分类</th>
                            <th>标记</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name='_list' id='vo'}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.title}</td>
                            <td>{$vo.pid|getCateName}</td>
                            <td>{$vo.mark}</td>
                            <td>
                                <a class="btn btn-primary" href="{:url('editCate',array('id'=>$vo['id']))}">编辑</a>
                                <a class="btn btn-warning" href="javascript:;" onclick="del({$vo.id});">删除</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                {else/}
                <div style="text-align: center">
                    <image src="__PUBLIC__/images/empty.jpg"></image>
                </div>

                {/notempty}
            </section>
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<script type="text/javascript">
    function del(id) {
        layer.confirm('确定要删除吗?', function () {
            $.post("{:url('delCate')}", {id: id}, function (data) {
                layer.msg(data.msg);
                location.href = "{:url('shopcategory')}";
            }, 'json');
        })
    }
</script>
{/block}